<style>
.row .col-lg-4{height:22px;}
.Wdate{
	height:30px;
	width:250px;
}
</style>



<div class="row">
	<div class="col-lg-12">
		<h1 class="page-header">查看玩家信息</h1>
	</div>
	<!-- /.col-lg-12 -->
</div>

<div class="row">
	<div class="col-lg-12">
		<table class="table table-condensed">
			<tr><th>账号状态</th>
			<td>
				<div class="col-lg-3">当前状态：
					<?php if($banTime):?>
					<span style="text-decoration:underline;" onclick="linkPage('admin/banAccount')" class="text-danger">封号</span>
					<?php else:?>
					<span style="text-decoration:underline;" onclick="linkPage('admin/banAccount')" class="text-success">正常</span>
					<?php endif;?>
					<!--<button class="btn btn-danger btn-xs" type="button">冻结</button>-->
				</div>
			</td></tr>
			
			<tr><th>注册信息</th>
			<td>
				<div class="col-lg-6">用户名：
					<span class="text-warning"><?php echo @$registname?></span>
				</div>
			</td></tr>
			
			<tr><th>基础信息</th>
			<td>
				<div class="row">
					<div class="col-lg-3">playerId：<span class="text-warning"><?php echo $player['id']?></span></div>
					<div class="col-lg-3">userCode：<span class="text-warning"><?php echo $player['user_code']?></span></div>
					<div class="col-lg-3">昵称：<span class="text-warning"><?php echo $player['nick']?></span> <button class="btn btn-danger btn-xs" type="button" onclick="linkPage('admin/logCommon', {'logType':'更改昵称'}, true)">历史昵称</button></div>
				</div>

				<div class="row">
					<div class="col-lg-3">主公等级：<span class="text-warning"><?php echo $player['level']?></span></div>
					<div class="col-lg-3">VIP等级：<span class="text-warning"><?php echo $player['vip_level']?></span><?php if(@$vipReset){?><button class="btn btn-danger btn-xs" type="button" onclick="vipReset(<?php echo $player['id']?>)">修正</button><?php }?></div>
				</div>
			</td></tr>

			<tr><th>元宝</th>
			<td>
				<div class="row">
					<div class="col-lg-4">免费元宝：<span class="text-warning"><?php echo number_format($player['gem_gift'])?></span> <button class="btn btn-danger btn-xs" type="button" onclick="showFreeAddGem()">增加</button></div>
					<div class="col-lg-4">收费元宝：<span class="text-warning"><?php echo number_format($player['gem_rmb'])?></span> <button class="btn btn-danger btn-xs" type="button" onclick="showRmbAddGem()">增加</button></div>
				</div>
			</td></tr>

			<tr><th>登陆</th>
			<td>
				<div class="row">
					<div class="col-lg-4">登陆时间：<span class="text-warning"><?php echo date('Y-m-d H:i:s', $player['login_time'])?></span></div>
				</div>
			</td></tr>

		</table>
	</div>
	<!-- /.col-lg-12 -->
</div>



<!-- 增加元宝 -->
<div class="modal fade" id="addgemModal" tabindex="-1" role="dialog" aria-labelledby="addgemModalLabel">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
				<h4 class="modal-title" id="addgemModalLabel">增加元宝</h4>
			</div>
			<div class="modal-body">
				<div class="alert alert-danger" id="addgemModalErr" style="display:none">
						
				</div>
				<form>
					<div class="form-group">
						<input type="hidden" id="addgem_playerId" value="<?php echo $player['id']?>" />
						<label class="control-label">发送类型:</label>
						<div class="btn-group" data-toggle="buttons" style="display:block">
							<label class="btn btn-primary active">
								<input type="radio" name="addgem_addtype" id="addgem_addtype1" autocomplete="off" value="1" checked> 免费元宝
							</label>
							<label class="btn btn-primary">
								<input type="radio" name="addgem_addtype" id="addgem_addtype2" autocomplete="off" value="2"> 收费元宝
							</label>
						</div>
						<div style="clear:both"></div>
					</div>
					<div class="form-group">
						<label for="addgem_addGem" class="control-label">元宝数量:</label>
						<input type="text" class="form-control" id="addgem_addGem">
					</div>
					<div class="form-group">
						<label for="addgem_memo" class="control-label">原因:</label>
						<textarea class="form-control" id="addgem_memo"></textarea>
					</div>
				</form>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				<button type="button" class="btn btn-primary" onclick="sendAddGem()">确定</button>
			</div>
		</div>
	</div>
</div>

<!-- 修改属性 -->
<div class="modal fade" id="modPlayerAttrModal" tabindex="-1" role="dialog" aria-labelledby="modPlayerAttrModalLabel">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
				<h4 class="modal-title" id="modPlayerAttrLabel">修改属性</h4>
			</div>
			<div class="modal-body">
				<div class="alert alert-danger" id="modPlayerAttrModalErr" style="display:none">
						
				</div>
				<form>
					<div class="form-group">
						<input type="hidden" id="modPlayerAttr_playerId" value="<?php echo $player['id']?>" />
						<label class="control-label">发送类型:<span id="modPlayerAttr_addtypename" style="color:#C9302C"></span></label>
						<input type="hidden" id="modPlayerAttr_addtype" value="" /> 
						<div style="clear:both"></div>
					</div>
					<div class="form-group">
						<label for="modPlayerAttr_addvalue" class="control-label">增加/减少:</label>
						<input type="text" class="form-control" id="modPlayerAttr_addvalue" value=0>
					</div>
					<div class="form-group">
						<label for="modPlayerAttr_memo" class="control-label">原因:</label>
						<textarea class="form-control" id="modPlayerAttr_memo"></textarea>
					</div>
				</form>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				<button type="button" class="btn btn-primary" onclick="sendModAttr()">确定</button>
			</div>
		</div>
	</div>
</div>


<?php echo \Phalcon\Tag::javascriptInclude("js/My97DatePicker/WdatePicker.js"); ?>

<script>
function fixShowDefendSoldier(){
	$("#modPlayerFixSoldierModalErr").hide().html('');
	$("#modPlayerFixSoldier").modal();
}
function showFreeAddGem(){
	$("#addgemModalErr").hide().html('');
	$("#addgem_addtype1").click();
	$("#addgemModal").modal();
}

function showRmbAddGem(){
	$("#addgemModalErr").hide().html('');
	$("#addgem_addtype2").click();
	$("#addgemModal").modal();
}

function sendAddGem(){
	var playerId = $("#addgem_playerId").val();
	var addType = $("input[name=addgem_addtype]:checked").val();
	var addGem = $("#addgem_addGem").val();
	var memo = $("#addgem_memo").val();
	send_request_json('/admin/ajaxAddGem', 
		{playerId: playerId, addType: addType, addGem: addGem, memo: memo}, 
		function(ret){
		if(ret.err == 'ok'){
			$("#addgemModal").modal('hide');
			alertOk('发送成功', function(){
				location.reload();
			});
		}else{
			$("#addgemModalErr").show().html(ret.err);
		}
	});
}


function sendModAttr(){
	var playerId = $("#modPlayerAttr_playerId").val();
	var addType = $("#modPlayerAttr_addtype").val();
	var addValue = $("#modPlayerAttr_addvalue").val();
	var memo = $("#modPlayerAttr_memo").val();
	send_request_json('/admin/ajaxModPlayerAttr', 
		{playerId: playerId, addType: addType, addValue: addValue, memo: memo}, 
		function(ret){
		if(ret.err == 'ok'){
			$("#modPlayerAttrModal").modal('hide');
			alertOk('处理成功', function(){
				location.reload();
			});
		}else{
			$("#modPlayerAttrModalErr").show().html(ret.err);
		}
	});
}


// function doSkipNewbie(playerId){
// 	if(confirm('是否关闭新手引导')){
// 		send_request_json('/admin/ajaxPlayerSkipNewbie', 
// 			{playerId: playerId}, 
// 			function(ret){
// 			if(ret.err == 'ok'){
// 				alertOk('发送成功', function(){
// 					location.reload();
// 				});
// 			}else{
// 				alertErr(ret.err);
// 			}
// 		});
// 	}
// }


function vipReset(playerId){
	if(confirm('是否修正vip等级')){
		send_request_json('/admin/ajaxVipReset', 
			{playerId: playerId}, 
			function(ret){
			if(ret.err == 'ok'){
				alertOk('修正成功', function(){
					location.reload();
				});
			}else{
				alertErr(ret.err);
			}
		});
	}
}

</script>